<?php
/**
 * (exporter) sku装箱规格（数量配置）
 */
namespace App\Exporter\ProductStockup;

use Encore\Admin\Grid\Exporters\ExcelExporter;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;

class SkuPackingSpecExporter extends ExcelExporter implements WithMapping,WithHeadings
{

    protected $fileName = 'sku装箱规格（新）.csv';

    public function headings(): array{
        return ['SKU','名称','品类','每箱发货数量'];
    }

    /**
     * 导出字段参数
     * @param mixed $model
     * @return array
     */
    public function map($model) : array{

        return [
            $model->sku->psku_code ?? '',
            $model->sku->psku_cn ?? '',
            $model->sku->classify->title,
            $model->num_per_box,
        ];
    }

}
